package com.bkhc.product.entity;


import com.bkhc.common.annotation.Uid;
import com.bkhc.common.enu.ProductStatusEnum;
import com.bkhc.common.listener.DataEntityListener;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 一個產品的實際產品實例
 */
@Entity
@Data
@Table(name = "tbl_goods_t")
@EntityListeners({AuditingEntityListener.class,DataEntityListener.class})
public class Goods {

    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private int id ;
    @Uid
    @Column(name = "goods_code")
    private String goodsCode;

    @Column(name = "product_code")
    private String productCode;

    @Column(name = "product_name")
    private String productName;

    @Column(name = "status")
    private ProductStatusEnum status;

    @Column(name = "remarks")
    private String remarks;

    @Transient
    private List<GoodsSpec> goodsSpec;

    @Transient
    private List<ProductPrice> prices;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;

    //是否被品牌关联商品选中
    @Transient
    private boolean checked;

}
